from selenium import webdriver
from selenium.webdriver.common.by import By

import  time

service = webdriver.ChromeService(executable_path='./chromedriver-win64/chromedriver.exe')
options = webdriver.ChromeOptions()
options.add_experimental_option('detach', True)
options.add_argument('--headless')
browser = webdriver.Chrome(service=service, options=options)
browser.get('https://www.baidu.com')
browser.save_screenshot("baidu.png")

time.sleep(2)

input = browser.find_element(by=By.ID, value='kw')
input.send_keys('张三')
button =browser.find_element(by=By.ID, value='su')
button.click()
time.sleep(2)
browser.save_screenshot('张三.png')
